package com.rmy.queue.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rmy.common.annotation.Log;
import com.rmy.common.core.controller.BaseController;
import com.rmy.common.core.domain.AjaxResult;
import com.rmy.common.enums.BusinessType;
import com.rmy.queue.domain.QmsBookingSetting;
import com.rmy.queue.service.IQmsBookingSettingService;
import com.rmy.common.utils.poi.ExcelUtil;
import com.rmy.common.core.page.TableDataInfo;

/**
 * 预约配置Controller
 * 
 * @author rmy
 * @date 2022-10-27
 */
@RestController
@RequestMapping("/queue/bookingsetting")
public class QmsBookingSettingController extends BaseController
{
    @Autowired
    private IQmsBookingSettingService qmsBookingSettingService;

    /**
     * 查询预约配置列表
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:list')")
    @GetMapping("/list")
    public TableDataInfo list(QmsBookingSetting qmsBookingSetting)
    {
        startPage();
        List<QmsBookingSetting> list = qmsBookingSettingService.selectQmsBookingSettingList(qmsBookingSetting);
        return getDataTable(list);
    }

    /**
     * 导出预约配置列表
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:export')")
    @Log(title = "预约配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QmsBookingSetting qmsBookingSetting)
    {
        List<QmsBookingSetting> list = qmsBookingSettingService.selectQmsBookingSettingList(qmsBookingSetting);
        ExcelUtil<QmsBookingSetting> util = new ExcelUtil<QmsBookingSetting>(QmsBookingSetting.class);
        util.exportExcel(response, list, "预约配置数据");
    }

    /**
     * 获取预约配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qmsBookingSettingService.selectQmsBookingSettingById(id));
    }

    /**
     * 新增预约配置
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:add')")
    @Log(title = "预约配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QmsBookingSetting qmsBookingSetting)
    {
        return toAjax(qmsBookingSettingService.insertQmsBookingSetting(qmsBookingSetting));
    }

    /**
     * 修改预约配置
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:edit')")
    @Log(title = "预约配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QmsBookingSetting qmsBookingSetting)
    {
        return toAjax(qmsBookingSettingService.updateQmsBookingSetting(qmsBookingSetting));
    }

    /**
     * 删除预约配置
     */
    @PreAuthorize("@ss.hasPermi('queue:bookingsetting:remove')")
    @Log(title = "预约配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qmsBookingSettingService.deleteQmsBookingSettingByIds(ids));
    }
}
